package com.chenfan.mcn.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chenfan.common.vo.UserVO;
import com.chenfan.mcn.dao.AnnualRebateApprovalMapper;
import com.chenfan.common.extension.mybatisplus.enhanced.EnhancedService;
import com.chenfan.mcn.model.AnnualRebateApproval;
import com.chenfan.mcn.model.McnPage;
import com.chenfan.mcn.model.dto.AnnualRebateApprovalAddDTO;
import com.chenfan.mcn.model.dto.AnnualRebateApprovalSearchDTO;
import com.chenfan.mcn.model.rpc.ChangeAnnualRebateStatusCallback;
import com.chenfan.mcn.model.vo.*;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 客户返点审批单 服务类
 * </p>
 *
 * @author lizhejin
 * @since 2021-03-02
 */
public interface AnnualRebateApprovalService extends EnhancedService<AnnualRebateApprovalMapper, AnnualRebateApproval> {

    /**
     * 客户返点审批单列表
     *
     * @param page      {@link McnPage}
     * @param searchDTO {@link AnnualRebateApprovalSearchDTO}
     * @return {@link Page<AnnualRebateVO>}
     */
    Page<AnnualRebateVO> getList(McnPage<AnnualRebateVO> page, AnnualRebateApprovalSearchDTO searchDTO);

    /**
     * 修改客户返点审批单状态
     *
     * @param id     {@link Long}
     * @param status {@link Integer}
     * @return {@link boolean}
     */
    boolean changeStatus(Long id, Integer status);

    /**
     * 新增/编辑客户返点审批单
     *
     * @param addDTO {@link AnnualRebateApprovalAddDTO}
     * @return {@link Long}
     */
    Long saveData(AnnualRebateApprovalAddDTO addDTO);

    /**
     * 详情
     *
     * @param id {@link Long}
     * @return {@link AnnualRebateInfo}
     */
    AnnualRebateInfo info(Long id);

    /**
     * 客户返点审批单列表导出
     *
     * @param searchDTO {@link AnnualRebateApprovalSearchDTO}
     * @param response  {@link HttpServletResponse}
     */
    void exportExcel(AnnualRebateApprovalSearchDTO searchDTO, HttpServletResponse response);

    /**
     * 计算金额
     *
     * @param discountCode {@link String}
     * @return {@link AnnualCalculateAmount}
     */
    AnnualCalculateAmount calculateAmount(String discountCode);

    /**
     * 财务修改客户返点审批单状态
     *
     * @param statusCallback      {@link ChangeAnnualRebateStatusCallback}
     * @param userVO              {@link UserVO}
     */
    void financeStatusChange(ChangeAnnualRebateStatusCallback statusCallback, UserVO userVO);

    /**
     * 根据折扣返点审批单号获取年度优惠政策信息
     *
     * @param discountCode            {@link String}
     * @param accumulatedIncomeAmount {@link BigDecimal}
     * @return {@link AnnualPreferentialPolicyInformation}
     */
    AnnualPreferentialPolicyInformation getAnnualPreferentialPolicyInformation(String discountCode, BigDecimal accumulatedIncomeAmount);

    /**
     * 通过返点合同编号获取详情
     *
     * @param rebateContractCode
     * @return
     */
    AnnualRebateApproval getByCode(String rebateContractCode);

    /**
     * 客户返点合同详情导出
     * @param id
     * @return
     */
    List<AnnualRebateExcutionOrderVO> exportDetail(Long id);
}
